package com.gec.zhs.controller;

import java.util.List;

import com.gec.zhs.entity.query.SyslogQuery;
import com.gec.zhs.entity.po.Syslog;
import com.gec.zhs.entity.vo.ResponseVO;
import com.gec.zhs.service.SyslogService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 系统日志 Controller
 */
@RestController("syslogController")
@RequestMapping("/syslog")
public class SyslogController extends ABaseController{

	@Resource
	private SyslogService syslogService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(SyslogQuery query){
		return getSuccessResponseVO(syslogService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(Syslog bean) {
		syslogService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<Syslog> listBean) {
		syslogService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<Syslog> listBean) {
		syslogService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getSyslogById")
	public ResponseVO getSyslogById(String id) {
		return getSuccessResponseVO(syslogService.getSyslogById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateSyslogById")
	public ResponseVO updateSyslogById(Syslog bean,String id) {
		syslogService.updateSyslogById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteSyslogById")
	public ResponseVO deleteSyslogById(String id) {
		syslogService.deleteSyslogById(id);
		return getSuccessResponseVO(null);
	}
}